Skip to content

Conversation

@sharonkeikei
Copy link

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, you hit most of all the learning goals here. Well done.

Take a look at my comments regarding palindrome_permutations and let me know if you have any questions.

@@ -1,4 +1,21 @@

def palindrome_permutation?(string)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to work.

Comment on lines +14 to +18
letter_hash.each_value do |times|
if times % 2 != 0
midpoint += 0
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would do better here to see how many letters appear an odd number of times.

Copy link
Author

@sharonkeikei sharonkeikei Apr 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, Chris! I had a typo in my code. so it should be
midpoint += 1 instead of midpoint += 0
I run rake file after that seems to fix the failures, would that be consider working for this method? Just wondering. Thanks!

`def palindrome_permutation?(string)
letter_hash = {}

string.split("").each do |letter|
if letter_hash[letter] == nil
letter_hash[letter] = 1
else
letter_hash[letter] += 1
end
end

midpoint = 0
letter_hash.each_value do |times|
if times % 2 != 0
midpoint += 1
end
end
return midpoint <= 1
end
`

@@ -1,4 +1,28 @@

def permutations?(string1, string2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants